﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using GraphGeneric;
using System.Windows;
using System.Windows.Media.Animation;

namespace MichaelTestApp
{
	public class KineticNode
	{

		public KineticNode()
		{
			m_velocity = new Vector(0, 0);
			m_netForce = new Vector(0, 0);
			m_mass = 1;
			
		}

        public KineticNode(Vector position)
        {
            m_velocity = new Vector(0, 0);
            m_netForce = new Vector(0, 0);
            m_mass = 1;
            //m_charge = charge;
            m_charge = 125;
            m_location = position;
        }

		public Vector Location
		{
			get { return m_location; }
			set { m_location = value; }
		}
		public Vector Velocity
		{
			get { return m_velocity; }
			set { m_velocity = value; }
		}

		public Vector NetForce
		{
			get { return m_netForce; }
			set { m_netForce = value; }
		}

		public double Mass
		{
			get { return m_mass; }
			set { m_mass = value; }
		}

		public double Charge
		{
			get { return m_charge; }
			set { m_charge = value; }
		}



		public IEnumerable<KineticNode> AdjacentNodes
		{
			get { return m_adjacentNodes; }
		}
		public void AddAdjacentNode(KineticNode node)
		{
            if (!m_adjacentNodes.Contains(node))
                m_adjacentNodes.Add(node);
		}
		public void RemoveAdjacentNode(KineticNode node)
		{
			if (!m_adjacentNodes.Contains(node))
				m_adjacentNodes.Remove(node);
		}
		public void AddFrame(Vector vector)
		{
			//xValues.Add(new LinearDoubleKeyFrame(vector.X));
			//yValues.Add(new LinearDoubleKeyFrame(vector.Y));
			SplineDoubleKeyFrame x = new SplineDoubleKeyFrame(vector.X);
			SplineDoubleKeyFrame y = new SplineDoubleKeyFrame(vector.Y);
			x.KeySpline = new KeySpline(0, 0, 1, 1);
			y.KeySpline = new KeySpline(0,0 , 1, 1);
			
			xValues.Add(x);
			yValues.Add(y);

		}
		public DoubleKeyFrameCollection KeyFramesX
		{
			get { return xValues; }
		}
		public DoubleKeyFrameCollection KeyFramesY
		{
			get { return yValues; }
		}
		private Vector m_location;
		private double m_mass;
		private double m_charge;
		private Vector m_velocity;
		private Vector m_netForce;
		private List<KineticNode> m_adjacentNodes = new List<KineticNode>();

		private PointKeyFrameCollection xyPostitions = new PointKeyFrameCollection();

		private DoubleKeyFrameCollection xValues = new DoubleKeyFrameCollection();
		private DoubleKeyFrameCollection yValues = new DoubleKeyFrameCollection();
	}
}
